import os
import random
from tqdm import tqdm
import shutil
import os.path
sameple_path = '/home/xys/CloundShiProjects/motorbicyle_detect/motor_light_classify/test/test/n     g'
delete_path = '/home/xys/CloundShiProjects/motorbicyle_detect/motor_light_classify/test/test'
sum = 0
for f in os.listdir(sameple_path):
    filedir = os.path.join(sameple_path,f)
    filedir_delete = os.path.join(delete_path,f)
    num = 0
    for file in os.listdir(filedir):
        file_back = file[-4:]
        file_front = file[:-4]
        file_d = os.path.join(filedir_delete,file)
        if os.path.exists(file_d):
            os.remove(file_d)
            num+=1
    print(num)
    sum+=num
print(sum)